package top.roud.dao.utils;

import java.sql.Connection;
import java.sql.DriverManager;

public class JdbcUtils {
	public static Connection getConnection() {
		String className = null;
		String filePath = "jdbc.properties";
		String url  =null;
		String name = null;
		String pwd = null;
		Connection conn = null;
		try {
			className = GetPropertiesUtils.getResult(filePath, "driverClassName");
			Class.forName(className);
			url = GetPropertiesUtils.getResult(filePath, "url");
			name = GetPropertiesUtils.getResult(filePath, "username");
			pwd = GetPropertiesUtils.getResult(filePath, "password");
			conn = DriverManager.getConnection(url,name,pwd);
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		
		return conn;
		
	}
}
